<{Tinclude "commom/admin_header"}>
 <section id="container" >
      
      <!--顶部-->
      <{Tinclude"commom/admin_inner_header"}>
      <!--顶部-->
      
       <{Tinclude"commom/admin_left_menu"}>
       
       <section id="main-content">
          <section class="wrapper">
          	<h3><i class="<{if $___menuinfo["iconclass"]}><{$___menuinfo["iconclass"]}><{else}>fa fa-list-ul<{/if}>"></i><{$___menuinfo["base_name"]}></h3>
                <div class="row mt">
                    <div class="col-md-12">
                       <div class="form-panel">  
                           
                           
                           <div class='col-md-6'>
                               <a class='btn btn-theme02 btn-sm' href="<{echo Common::RewriteUrl("Building","roompeijianadd");}>"><span class="fa fa-key"></span>添加</a>
                               
                           </div>  
                           <div class="col-md-6 text-right">
                                   
                                 <form class="form-inline" method="post" action="<{echo Common::RewriteUrl($jp_arg["c"],$jp_arg["a"]);}>">
  <div class="form-group">
    <label for="exampleInputName2">配件名</label>
    <input type="text" name="base_name" value="<?php if(isset($jp_arg['base_name']))echo $jp_arg['base_name'];?>" class="form-control" id="exampleInputName2" placeholder="配件名">
  </div>
  <button type="submit" class="btn btn-default">搜索</button>
</form>
                                   
                                   
                               </div>
                           <div class='clearfix'></div>
                           <div class='margin_top20'></div>
                           <div class="col-lg-12">
                           <div class="row">
                               
                                  <{if $list}>
                                 <section id="no-more-tables">                   
  <table class="table table-striped table-condensed table-hover cf">
      <thead class="cf">
        <tr>
          <th>缩略图</th>
          <th>配件名称</th>
          <th>金额</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      
          <{foreach $list as $item}>
          <tr>
              <td data-title="缩略图" class="jphidden-phone"><a href="<{echo Common::RewriteUrl("Building","roompeijianedit","&id=".$item["id"]);}>" ><img src="<{$item["thumb"]}>" class="img-responsive img-thumbnail" /></a></td>
              <td data-title="配件名称"><{$item["base_name"]}></td>
              <td data-title="金额"><{$item["price"]}>元</td>
              <td data-title="状态">
                  <div data-id="<{$item["id"]}>" class="switch switch-animate" data-placement="top"
                                       data-on-label="启用"
                                       data-off-label="禁用">
                      <input name="status" type="checkbox" <{if $item["status"]==1}>checked<{/if}> />
                                  </div>
              </td>
              <td data-title="操作">
                  <div class="btn-group">  
              <a class="btn btn-primary btn-xs" href="<{echo Common::RewriteUrl("Building","roompeijianedit","&id=".$item["id"]);}>" ><span class="glyphicon glyphicon-edit"></span></a><a class="btn btn-danger btn-xs" href="<{echo Common::RewriteUrl("Building","roompeijiandelete","&id=".$item["id"]);}>"><span class="glyphicon glyphicon-trash"></span></a>
              </div>
              </td>
          </tr>
          <{/foreach}>
    
      </tbody>
  </table>
                                 </section>
                              
                          <div class="col-md-12 text-center">
                           <?php Temp::Tinclude("commom/pager");?>
                           </div>
                                    <{else}>
                             <div class="col-md-12 col-xs-12">
                                 <h4 class="text-center">数据为空</h4>
                             </div>
                     
                            <{/if}>         
                               
                           </div>
                           </div>
                           <div class="clearfix"></div>
                           
                           
 
                           
                           
                           
                       </div>
                    </div>
                </div>
          </section>
       </section>
 </section>
<script>
  $(document).ready(function(){
      $(".switch").click(function(){
          var obj=$(this);
          var id=obj.data("id");
          
          var status=obj.find("input[name='status']").get(0).checked;
          status=status?1:0;
          $.post("<{echo Common::RewriteUrl("Building","public_ajax_roompeijianstatus");}>",{"id":id,"status":status},function(data){
              if(data.status){
                  obj.popover('show');
              }else{
                  alert("更新状态失败!");
              }
          },"json");
      });
  });
</script>
<{Tinclude"commom/admin_footer"}>